import json
from flask import Flask, render_template
from wsgiref.simple_server import make_server

app = Flask(__name__)

@app.route('/userlist')
def show_users():
    users = [
        {"name": "Tom", "age": "18", "sex": 1},
        {"name": "Coral", "age": "17", "sex": 0},
        {"name": "Kate", "age": "18", "sex": 0}
    ]
    return render_template("userlist.html",users=users)

if  __name__ == '__main__':
    server = make_server('127.0.0.1',5000,app) #外部访问的url,端口
    server.serve_forever()
    app.run()

